# -*- coding: utf-8 -*-

'''eof
name:性别
code:IG02_Gender
tableName:
columnName:
groups:个人通用模块
dependencies:EG_DSJ
type:常用指标
datasourceType:在线指标
description:
eof'''


import sys
import pandas as pd
import json
from datetime import datetime


def getIG02():
    null_type_list = ['', ' ', None, 'null', 'Null', 'NULL', '/', '-', '--']
    try:
        card_id = ratingRequest.get("legalPersonIdCard")
        if card_id not in null_type_list and len(card_id) == 18:
            gender = int(card_id[16]) % 2
            if gender == 1:
                return u'男'
            else:
                return u'女'
        else:
            return u'缺失值'

    except:
        return u'缺失值'


result = getIG02()

if __name__ == "__main__":
    ratingRequest = {"legalPersonIdCard":"500101199201122461","aa":"aa","bb":""}
    aa = getIG02()
    print aa